import { request } from '@umijs/max';

// 获取脚本列表
export async function getScriptList(params?: Record<string, any>, options?: Record<string, any>) {
  return request('/api/ai_management/auto_script/list', {
    method: 'GET',
    params: {
      ...params,
    },
    headers: {
      isToken: false,
    },
    ...(options || {}),
  });
}

// 下载脚本
export async function downloadScript(body: Record<string, any>, options?: Record<string, any>) {
  return request('/api/ai/auto_script/download', {
    method: 'POST',
    headers: {
      isToken: false,
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

// 新增脚本
export async function addScript(body: Record<string, any>, options?: Record<string, any>) {
  return request('/api/ai_management/auto_script/save', {
    method: 'POST',
    headers: {
      isToken: false,
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

// 下架脚本
export async function offScript(body: Record<string, any>, options?: Record<string, any>) {
  return request('/api/ai_management/auto_script/inactive', {
    method: 'POST',
    headers: {
      isToken: false,
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

// 编辑脚本
export async function editScript(body: Record<string, any>, options?: Record<string, any>) {
  return request('/api/ai_management/auto_script/edit', {
    method: 'POST',
    headers: {      
      isToken: false,
      'Content-Type': 'application/json',
    },    
    data: body,
    ...(options || {}),
  });
}